package com.example.demo.config.datasource;

/**
 * TODO
 *
 * @author wuhong-016
 * @version v1.0.0
 * @time: 2021/10/16 17:19
 */
public class DynamicDataSourceHolder {

    private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();

    public static void set(String name) {
        CONTEXT_HOLDER.set(name);
    }

    public static void clear() {
        CONTEXT_HOLDER.remove();
    }

    public static String get() {
        return CONTEXT_HOLDER.get();
    }

}
